﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OleDb;
using DTO;

namespace DAO
{
    public class DAO_LoaiNV
    {
        public static bool themloainv(DTO_LoaiNhanVien loai)
        {
            string truyvan = string.Format("insert into loainhanvien(tenloainv) values('" + loai.TenLoaiNV + "')");
            if (DataProvider.Capnhatdl(truyvan) > 0)
            {
                return true;
            }
            return false;
        }
        public static bool xoaloainv(DTO_LoaiNhanVien loai)
        {
            string truyvan = string.Format("delete from loainhanvien where maloainv =" + loai.MaLoaiNV);
            if (DataProvider.Capnhatdl(truyvan) > 0)
            {
                return true;
            }
            return false;
        }
        public static bool sualoainv(DTO_LoaiNhanVien loai)
        {
            string truyvan = string.Format("update loainhanvien set tennhanvien='" + loai.TenLoaiNV + "' where maloainv =" + loai.MaLoaiNV);
            if (DataProvider.Capnhatdl(truyvan) > 0)
            {
                return true;
            }
            return false;
        }

        public static DataTable LayLoaiNV()
        {
            return DataProvider.laydulieubang("Select * from LoaiNhanVien", DataProvider.c);
        }
    }
}
